ioemu: VNC updates should be sent only when requested.
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 26 Feb 2008 14:50:45 +0000 (14:50 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 26 Feb 2008 14:50:45 +0000 (14:50 +0000)
commitbe2808a3bf0d5fed81d01872323717d457753133
tree6c540271bd06253f97d02109a9e876a2eb0ce015
parent26a1b308f37898b744d3b38477edcfb0a23b93cc
ioemu: VNC updates should be sent only when requested.

Reading qemu code I realized that the qemu vnc server sometimes sends
framebuffer updates even if the client didn't request any. This is not
consistent with the RFB protocol spec and can break some clients.
This patch strictly enforces compliance with the RFB protocol making
sure framebuffer updates are sent only if the client requested one.
Doing so is more difficult than it seems because some framebuffer
pseudo-encoding updates cannot be discarded but must be sent anyway:
for example desktop resize and pixel format change messages. To solve
the problem I wrote a queue that stores those messages and sends them
as soon as the client asks for an update. Since 90% of the times the
queue is used to store only few elements, the queue allocates 10
elements at the beginning and every time it runs out of elements
allocates other 10 elements. This is should drastically limit the
number of malloc and free needed to maintain the queue. I did some
stress tests in the last couple of days and seems to work well.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
tools/ioemu/vnc.c